<template>
	<view class="page renewal_list">
		<view class="card renewal_item" v-for="item in list" :key="item.id"
			@click="gotoPage(`/pagesCommon/prescription/renewalPrescriptionDetails?id=${item.id}`)">
			<view class="patient">
				<view class="patient_avarat">
					<image
						:src="item.avarat||'https://admin.yuanfenjihua.com/admin-api/infra/file/0/get/7d485f174dd88232f08d5d0ea6d05b153a3857402e3ce776d2c1eca015cad0cb.png'"
						mode="scaleToFill"></image>
				</view>
				<view class="patient_info">
					<view class="info">
						<view class="info_title">
							<text>{{item.patientName || ''}}</text>
							<text class="info_subtitle">{{item.sex==1?"男":"女" || '男'}}</text>
							<text class="info_subtitle">{{item.age || ''}}岁</text>
						</view>
						<view class="status">
							{{item.statusName || ''}}
						</view>
					</view>
					<view class="disease ellipsis-1">
						<text class="gray">[病情描述]</text> {{item.diseaseDescribe || ''}}
					</view>
				</view>
			</view>
			<view class="item_more">
				<view class="date">
					生成时间: {{$dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss')}}
				</view>
				<view class="text">
					查看详情
					<uni-icons type="right" size="12" color="#999"></uni-icons>
				</view>
			</view>
		</view>
		<view class="btns" @click="gotoPage('/pagesCommon/prescription/addRenewalPrescription')">
			在线续方
		</view>
	</view>
</template>

<script>
	import {
		getOnlinePreFormPage
	} from '@/api/index.js'
	export default {
		data() {
			return {
				list: [],
				total: 0,
				queryForm: {
					pageNo: 1,
					pageSize: 10,
				}
			}
		},
		onLoad() {
			this.getOnlinePreFormPage()
		},
		methods: {
			getOnlinePreFormPage() {
				getOnlinePreFormPage(this.queryForm).then(res => {
					this.list = res.data.list
					this.total = res.total
				}).catch((err) => {
					console.log(err)
				})
			},
			gotoPage(url) {
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.renewal_list {
		.btns {
			position: fixed;
			left: 0;
			right: 0;
			bottom: 100rpx;
			margin: 0 30rpx;
			padding: 40rpx 0;
		}

		.renewal_item {
			margin-bottom: 30rpx;
			.patient {
				display: flex;
				align-items: center;
				margin-bottom: 20rpx;

				.patient_avarat {
					flex: 0 0 90rpx;
					width: 90rpx;
					height: 90rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.patient_info {
					flex: auto;
					margin-left: 20rpx;

					.info {
						width: 100%;
						display: flex;
						align-items: center;
						justify-content: space-between;
						margin-bottom: 20rpx;

						.info_title {
							font-size: 32rpx;
							color: #333333;
							font-weight: bold;

							&>text {
								display: inline-block;
								margin-right: 10rpx;
							}

							.info_subtitle {
								font-weight: normal;
								font-size: 24rpx;
								color: #666666;
							}
						}

						.status {
							text-align: right;
							font-size: 22rpx;
							color: #F1AE34;
						}
					}

					.disease {
						color: #333333;
						font-size: 26rpx;
						color: #999999;

						.gray {
							color: #999;
						}
					}
				}
			}

			.item_more {
				margin-left: 110rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 22rpx;
				color: #999999;
			}
		}
	}
</style>